﻿<%@ Control Language="C#" AutoEventWireup="true" EnableViewState="false" CodeBehind="AdminReportV2.ascx.cs" Inherits="SvOtchet.controls.AdminReportV2" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.1, Version=8.1.6.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v8.1, Version=8.1.6.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>

<%@ Register assembly="DevExpress.Web.ASPxGridView.v8.1.Export, Version=8.1.6.0, Culture=neutral, PublicKeyToken=9b171c9fd64da1d1" Namespace="DevExpress.Web.ASPxGridView.Export" TagPrefix="dxwgv" %>


<h3>Формирование отчетности по заданному округу и периоду</h3>
<p>Для формирования отчета необходимо:</p>
<ol>
    <li>Выбрать из списка подотчетных округов нужный:
        <ul><li>если выбран пункт «Сводный отчет», то будет выведена информация по всем округам.</li></ul>
    </li>
    <li>Выбрать отчетный год и месяц:
        <ul><li>если месяц не выбран, то будет выведена информация по всему году.</li></ul>
    </li>
</ol>

<table border="0" cellspacing=10 class="no">
    <tr>
        <td>
            Округ:<br />
            <dxe:ASPxComboBox ID="orgs" runat="server" DataSourceID="OrgDS" Width="184px" 
                TextField="OrganizationName" ValueField="OrganizationID"
                ValueType="System.String" CssFilePath="~/App_Themes/Glass/{0}/styles.css" 
                CssPostfix="Glass" ImageFolder="~/App_Themes/Glass/{0}/">
                <ButtonStyle Cursor="pointer" Width="13px">
                </ButtonStyle>
            </dxe:ASPxComboBox>
        </td>
        <td>
            Год:<br />
            <dxe:ASPxComboBox ID="years" runat="server" DataSourceID="YearDS" Width="180px"
                TextField="year" ValueField="year" ValueType="System.String" 
                CssFilePath="~/App_Themes/Glass/{0}/styles.css" CssPostfix="Glass" 
                ImageFolder="~/App_Themes/Glass/{0}/">
                <ButtonStyle Cursor="pointer" Width="13px">
                </ButtonStyle>
            </dxe:ASPxComboBox>
        </td>
        <td>
            Месяц:<br />
            <dxe:ASPxComboBox ID="monthnums" runat="server" DataSourceID="monthDS" Width="180px" 
                TextField="monthName" ValueField="monthNum"
                ValueType="System.String" CssFilePath="~/App_Themes/Glass/{0}/styles.css" 
                CssPostfix="Glass" ImageFolder="~/App_Themes/Glass/{0}/">
                <ButtonStyle Cursor="pointer" Width="13px">
                </ButtonStyle>
            </dxe:ASPxComboBox>
        </td>
        <td class="knopka">
            <dxe:ASPxButton ID="ASPxButton1" runat="server" onclick="ASPxButton1_Click" 
                Text="Сформировать отчет" EnableClientSideAPI="True" Border-BorderColor="#666666" Border-BorderWidth="1px" 
                CssFilePath="~/App_Themes/Glass/{0}/styles.css" CssPostfix="Glass">
            </dxe:ASPxButton>
        </td>
    </tr>
    <tr>
        <td>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
            ControlToValidate="orgs" ErrorMessage="Необходимо выбрать округ!"></asp:RequiredFieldValidator>
        </td>
        <td>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
            ControlToValidate="years" ErrorMessage="Необходимо выбрать год!"></asp:RequiredFieldValidator>
        </td>
        <td></td>
        <td></td>
    </tr>
</table>


    <asp:MultiView ID="MultiView1" runat="server">
    <asp:View ID="prereport" runat="server">
        <asp:ObjectDataSource ID="empryreportlist" runat="server" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
            TypeName="SvOtchet.DataModel.sp.GetSubOrganizationWithEmptyReportTableAdapters.GetSubOrganizationWithEmptyReportTableAdapter">
            <SelectParameters>
                <asp:ControlParameter ControlID="monthnums" Name="Month" PropertyName="Value" 
                    Type="Int32" />
                <asp:ControlParameter ControlID="years" Name="Year" PropertyName="Value" 
                    Type="Int32" />
                <asp:ControlParameter ControlID="orgs" Name="OrgId" PropertyName="Value" 
                    Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <p>Создание отчета за данный период невозможно.<br />Не сдали отчеты:</p><br />
        <dxwgv:ASPxGridView ID="ASPxGridView1" runat="server" 
            AutoGenerateColumns="False" DataSourceID="empryreportlist" 
            KeyFieldName="Id" CssFilePath="~/App_Themes/Glass/{0}/styles.css" 
            CssPostfix="Glass">
            <Styles CssFilePath="~/App_Themes/Glass/{0}/styles.css" CssPostfix="Glass">
                <Header ImageSpacing="5px" SortingImageSpacing="5px">
                </Header>
            </Styles>
            <Images ImageFolder="~/App_Themes/Glass/{0}/">
                <CollapsedButton Height="12px" Width="11px" />
                <DetailCollapsedButton Height="9px" Width="9px" />
                <PopupEditFormWindowClose Height="17px" Width="17px" />
            </Images>
            <SettingsPager PageSize="50">
            </SettingsPager>
            <Columns>
                <dxwgv:GridViewDataTextColumn FieldName="Id" ReadOnly="True" Visible="False" 
                    VisibleIndex="0">
                    <EditFormSettings Visible="False" />
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Name" Visible="False" VisibleIndex="0">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="Муниципалитеты" FieldName="FullName" 
                    VisibleIndex="0">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Visible="false" FieldName="UserId" VisibleIndex="1">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="OrganizationId" Visible="False" 
                    VisibleIndex="1">
                </dxwgv:GridViewDataTextColumn>
            </Columns>
        </dxwgv:ASPxGridView>
    </asp:View>
    <asp:View ID="report" runat="server">
    
        <table style="float: right;" border="0" cellpadding="0" cellspacing="5">
         <tr>
             <td>
             <dxe:ASPxButton ID="btnXlsExport" runat="server" Text="Экспорт в Exel" UseSubmitBehavior="False"
                     OnClick="btnXlsExport_Click" 
                     CssFilePath="~/App_Themes/Glass/{0}/styles.css" CssPostfix="Glass">
</dxe:ASPxButton>
            </td>
             <td>
                 <dxe:ASPxButton ID="btnSelectAll" runat="server" Text="Выбрать все" 
                     UseSubmitBehavior="False" AutoPostBack="False" 
                     CssFilePath="~/App_Themes/Glass/{0}/styles.css" CssPostfix="Glass">
                     <ClientSideEvents Click="function(s, e) { ASPxGridView2.SelectRows(); }"/>                
                 </dxe:ASPxButton>
             </td>
             <td>
                 <dxe:ASPxButton ID="btnUnselectAll" runat="server" Text="Снять все выделения" 
                     UseSubmitBehavior="False" AutoPostBack="False" 
                     CssFilePath="~/App_Themes/Glass/{0}/styles.css" CssPostfix="Glass">
                     <ClientSideEvents Click="function(s, e) { ASPxGridView2.UnselectRows(); }"/>
                 </dxe:ASPxButton>
             </td>
         </tr>
        </table><br /><br />
    
        <dxwgv:ASPxGridView ID="ASPxGridView2" ClientInstanceName="ASPxGridView2" runat="server" 
            AutoGenerateColumns="False" DataSourceID="fullreport" 
            CssFilePath="~/App_Themes/Glass/{0}/styles.css" CssPostfix="Glass"
            Width="100%" KeyFieldName="ItemId"
            OnCustomCallback="grid_CustomCallback"
>
            <Styles CssFilePath="~/App_Themes/Glass/{0}/styles.css" CssPostfix="Glass">
                <Header ImageSpacing="5px" SortingImageSpacing="5px">
                </Header>
            </Styles>
            <Images ImageFolder="~/App_Themes/Glass/{0}/">
                <CollapsedButton Height="12px" Width="11px" />
                <DetailCollapsedButton Height="9px" Width="9px" />
                <PopupEditFormWindowClose Height="17px" Width="17px" />
            </Images>
            <SettingsPager PageSize="60">
            </SettingsPager>
            <Columns>
                <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" Caption=" " VisibleIndex="0">
                    </dxwgv:GridViewCommandColumn>

                <dxwgv:GridViewDataTextColumn FieldName="VisualId" Caption="№" VisibleIndex="1">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Name" Caption="Задачи и основные мероприятия" VisibleIndex="2">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="Measure" Caption="Единицы измерения показателя" VisibleIndex="3">
                </dxwgv:GridViewDataTextColumn>
                 <dxwgv:GridViewDataTextColumn FieldName="PrecedingYear" Caption="Значение показателя на 1 января" VisibleIndex="4">
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn FieldName="DataColumn" Caption="Значение показателя" ReadOnly="True" 
                    VisibleIndex="5">
                </dxwgv:GridViewDataTextColumn>
            </Columns>
            <Settings ShowGroupPanel="false" ShowFooter="True" ShowFilterRow="True"/>
        </dxwgv:ASPxGridView>
        <dxwgv:ASPxGridViewExporter ID="gridExport" runat="server" GridViewID="ASPxGridView2" ExportedRowType="Selected"></dxwgv:ASPxGridViewExporter>
        <br />
        <br />
        
        
        <asp:ObjectDataSource ID="fullreport" runat="server" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
            TypeName="SvOtchet.DataModel.sp.GetReportForAdminV2TableAdapters.GetReportForAdminV2TableAdapter">
            <SelectParameters>
                <asp:ControlParameter ControlID="orgs" Name="OrgId" PropertyName="Value" 
                    Type="Int32" />
                <asp:ControlParameter ControlID="years" Name="Year" PropertyName="Value" 
                    Type="Int32" />
                <asp:ControlParameter ControlID="monthnums" Name="Month" PropertyName="Value" 
                    Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
    
    </asp:View>
    </asp:MultiView>
</p>
<asp:ObjectDataSource ID="OrgDS" runat="server" DeleteMethod="Delete" 
    InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" 
    SelectMethod="GetData" 
    TypeName="SvOtchet.DataModel.todb.orgTableAdapters.OrganizationsTableAdapter" 
    UpdateMethod="Update">
    <DeleteParameters>
        <asp:Parameter Name="Original_OrganizationID" Type="Int32" />
    </DeleteParameters>
    <UpdateParameters>
        <asp:Parameter Name="OrganizationName" Type="String" />
        <asp:Parameter Name="Original_OrganizationID" Type="Int32" />
    </UpdateParameters>
    <InsertParameters>
        <asp:Parameter Name="OrganizationName" Type="String" />
    </InsertParameters>
</asp:ObjectDataSource>

<asp:ObjectDataSource ID="YearDS" runat="server" 
    OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
    TypeName="SvOtchet.DataModel.sp.GetAllReportYearListTableAdapters.GetAllReportYearListTableAdapter">
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="monthDS" runat="server" DeleteMethod="Delete" 
    InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" 
    SelectMethod="GetData" 
    TypeName="SvOtchet.DataModel.todb.monthTableAdapters.monthTableAdapter" 
    UpdateMethod="Update">
    <DeleteParameters>
        <asp:Parameter Name="Original_id" Type="Int32" />
    </DeleteParameters>
    <UpdateParameters>
        <asp:Parameter Name="monthName" Type="String" />
        <asp:Parameter Name="monthNum" Type="String" />
        <asp:Parameter Name="Original_id" Type="Int32" />
    </UpdateParameters>
    <InsertParameters>
        <asp:Parameter Name="id" Type="Int32" />
        <asp:Parameter Name="monthName" Type="String" />
        <asp:Parameter Name="monthNum" Type="String" />
    </InsertParameters>
</asp:ObjectDataSource>






